/**
 * 
 */
package com.kexinde.wjifen.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.kexinde.wjifen.dao.impl.ShopDao;
import com.kexinde.wjifen.model.Shop;
import com.kexinde.wjifen.service.IShopManager;

/**
 * @author vincent
 *
 */
@Component("shopManager")
public class ShopManager implements IShopManager {
	
	private ShopDao shopDao;

	/* (non-Javadoc)
	 * @see com.kexinde.wjifen.service.IShopManager#showAllShops()
	 */	
	@Override	
	public List<Shop> showAllShops() {
		// TODO Auto-generated method stub
		return this.shopDao.findAll("Shop",null,null);
	}

	/* (non-Javadoc)
	 * @see com.kexinde.wjifen.service.IShopManager#showIndexShops()
	 */
	@Override
	public List<Shop> showIndexShops() {
		// TODO Auto-generated method stub
		return null;
	}

	/* (non-Javadoc)
	 * @see com.kexinde.wjifen.service.IShopManager#add(com.kexinde.wjifen.model.Shop)
	 */
	@Override
	public boolean add(Shop shop) {
		// TODO Auto-generated method stub
		return this.shopDao.doInsert(shop);
	}

	/* (non-Javadoc)
	 * @see com.kexinde.wjifen.service.IShopManager#modify(com.kexinde.wjifen.model.Shop)
	 */
	@Override
	public boolean modify(Shop shop) {
		// TODO Auto-generated method stub
		return this.shopDao.doUpdate(shop);
	}

	/* (non-Javadoc)
	 * @see com.kexinde.wjifen.service.IShopManager#invalidateShop(com.kexinde.wjifen.model.Shop)
	 */
	@Override
	public boolean invalidateShop(Shop shop) {
		// TODO Auto-generated method stub
		shop.setPurview(0);
		return this.shopDao.doUpdate(shop);
	}

	/* (non-Javadoc)
	 * @see com.kexinde.wjifen.service.IShopManager#validateShop(com.kexinde.wjifen.model.Shop)
	 */
	@Override
	public boolean validateShop(Shop shop) {
		// TODO Auto-generated method stub
		shop.setPurview(1);
		return this.shopDao.doUpdate(shop);
	}

	@Override
	public Shop showShop(Long id) {
		// TODO Auto-generated method stub
		return this.shopDao.findById(id);
	}

	public ShopDao getShopDao() {
		return shopDao;
	}
	@Resource
	public void setShopDao(ShopDao shopDao) {
		this.shopDao = shopDao;
	}

}
